<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <!--准备好一个“容器”-->
    <div id="test"></div>
    <div id="test1"></div>

    <!--引入react核心库,必须在dom前面引入-->
    <script type="text/javascript" src="../js/react.development.js"></script>
    <!--引入react_dom，用于支持react操作DOM-->
    <script type="text/javascript" src="../js/react-dom.development.js"></script>
    <!--引入babel，用于将jsx转为js-->
    <script type="text/javascript" src="../js/babel.min.js"></script>
    <script type="text/babel">
        // 创建组件
        class Person extends React.Component{
            render(){
               // const {name,sex,age} = this.props
                return(
                    <div>
                        <ul>
                            <li>姓名：{this.props.name}</li>
                            <li>性别：{this.props.sex}</li>
                            <li>年龄：{this.props.age+1}</li>
                        </ul>
                    </div>
                )
            }
        }

        ReactDOM.render(<Person name="蕾蕾" sex="女" age={18}/>,document.getElementById('test'))

        const p = {name:'楠楠',sex:'女',age:21}
        ReactDOM.render(<Person {...p}/>,document.getElementById('test1'))

    </script>

</body>
</html>